package com.ruoyi.modules.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SnowflakeIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.modules.mapper.TransportationCompanyMapper;
import com.ruoyi.modules.domain.TransportationCompany;
import com.ruoyi.modules.service.ITransportationCompanyService;

/**
 * 运输公司信息Service业务层处理
 * 
 * @author ssh
 * @date 2024-12-15
 */
@Service
public class TransportationCompanyServiceImpl implements ITransportationCompanyService 
{
    @Autowired
    private TransportationCompanyMapper transportationCompanyMapper;

    /**
     * 查询运输公司信息
     * 
     * @param id 运输公司信息主键
     * @return 运输公司信息
     */
    @Override
    public TransportationCompany selectTransportationCompanyById(String id)
    {
        return transportationCompanyMapper.selectTransportationCompanyById(id);
    }

    /**
     * 查询运输公司信息列表
     * 
     * @param transportationCompany 运输公司信息
     * @return 运输公司信息
     */
    @Override
    public List<TransportationCompany> selectTransportationCompanyList(TransportationCompany transportationCompany)
    {
        return transportationCompanyMapper.selectTransportationCompanyList(transportationCompany);
    }

    /**
     * 新增运输公司信息
     * 
     * @param transportationCompany 运输公司信息
     * @return 结果
     */
    @Override
    public int insertTransportationCompany(TransportationCompany transportationCompany)
    {
        SnowflakeIdUtils idWorker = new SnowflakeIdUtils(1, 3);
        transportationCompany.setId(idWorker.nextId()+"");
        transportationCompany.setCreateTime(DateUtils.getNowDate());
        return transportationCompanyMapper.insertTransportationCompany(transportationCompany);
    }

    /**
     * 修改运输公司信息
     * 
     * @param transportationCompany 运输公司信息
     * @return 结果
     */
    @Override
    public int updateTransportationCompany(TransportationCompany transportationCompany)
    {
        transportationCompany.setUpdateTime(DateUtils.getNowDate());
        return transportationCompanyMapper.updateTransportationCompany(transportationCompany);
    }

    /**
     * 批量删除运输公司信息
     * 
     * @param ids 需要删除的运输公司信息主键
     * @return 结果
     */
    @Override
    public int deleteTransportationCompanyByIds(String[] ids)
    {
        return transportationCompanyMapper.deleteTransportationCompanyByIds(ids);
    }

    /**
     * 删除运输公司信息信息
     * 
     * @param id 运输公司信息主键
     * @return 结果
     */
    @Override
    public int deleteTransportationCompanyById(String id)
    {
        return transportationCompanyMapper.deleteTransportationCompanyById(id);
    }
}
